import javax.swing.*;
import java.util.Objects;
import java.util.Scanner;

public class Changer {
	public static void main(String[] args) {
		if (args[0] == null || args[0].length() == 0 ||
				Objects.equals(args[0], "t") || Objects.equals(args[0], "g")) {
			int amount;
			int originalAmount;
			int quarters;
			int dimes;
			int nickels;
			int pennies;

			System.out.println("Enter a whole number from 1 to 99.");
			System.out.println("I will find a combination of coins");
			System.out.println("that equals that amount of change.");

			Scanner keyboard = new Scanner(System.in);
			amount = keyboard.nextInt();

			originalAmount = amount;
			quarters = amount / 25;
			amount = amount % 25;
			dimes = amount / 10;
			amount = amount % 10;
			nickels = amount / 5;
			amount = amount % 5;
			pennies = amount;

			System.out.println(originalAmount +
					" cents in coins can be given as:");
			System.out.println(quarters + " quarters");
			System.out.println(dimes + " dimes");
			System.out.println(nickels + " nickels and");
			System.out.println(pennies + " pennies");
		} else if (Objects.equals(args[0], "dialog")) {
			String amountString = JOptionPane.showInputDialog(
					"Enter a whole number from 1 to 99.\n" +
							"I will find a combination of coins\n" +
							"that equals that amount of change.");

			int amount;
			int originalAmount;
			int quarters;
			int dimes;
			int nickels;
			int pennies;

			amount = Integer.parseInt(amountString);
			originalAmount = amount;

			quarters = amount / 25;
			amount = amount % 25;
			dimes = amount / 10;
			amount = amount % 10;
			nickels = amount / 5;
			amount = amount % 5;
			pennies = amount;

			JOptionPane.showMessageDialog(null, originalAmount +
					" cents in coins can be given as:\n" +
					quarters + " quarters\n" +
					dimes + " dimes\n" +
					nickels + " nickels and\n" +
					pennies + " pennies");

			System.exit(0);
		}
	}
}
